﻿using System;
using System.Linq;
using System.IO;

namespace Snappy.Sharp
{
    public static class Snappy
    {
        public static byte[] Compress(byte[] uncompressed)
        {
            var target = new SnappyCompressor();
            var result = new byte[target.MaxCompressedLength(uncompressed.Length)];
            var count = target.Compress(uncompressed, 0, uncompressed.Length, result);
            return result.Take(count).ToArray();
        }

        public static byte[] Decompress(byte[] compressed)
        {
            return new SnappyDecompressor().Decompress(compressed, 0, compressed.Length);
        }
    }
}
